import request, {formRequest, logoutRequest}from '@/utils/request';
import { baseUrl } from '@/utils/settings';

export async function login(param) {
  return formRequest(baseUrl + 'login',{ method:'post', data: param.payload}, param.type);
}

export async function checkUsernamePassword(param) {
  return request(baseUrl + 'user/checkUsernamePassword',{ method:'post', data: param.payload}, param.type);
}

export async function logout() {
  return logoutRequest(baseUrl + 'user/logout', { method:'post', data: {}});
}

export async function getTokenInfo(param) {
  return request(baseUrl + 'user/getTokenInfo',{ method:'get', data: param.payload}, param.type);
}

export async function selUserAll(param) {
  return request(baseUrl + 'user/selUserAll',{ method:'post', data: param.payload}, param.type);
}

export async function selUserByUsername(param) {
  return request(baseUrl + 'user/selUserByUsername',{ method:'post', data: param.payload}, param.type);
}

export async function selUserByUsernameLike(param) {
  return request(baseUrl + 'user/selUserByUsernameLike',{ method:'post', data: param.payload}, param.type);
}

export async function delUser(param) {
  return request(baseUrl + 'user/delUser',{ method:'post', data: param.payload}, param.type);
}

export async function addUser(param) {
  return request(baseUrl + 'user/addUser',{ method:'post', data: param.payload}, param.type);
}

export async function updateUser(param) {
  return request(baseUrl + 'user/updateUser',{ method:'post', data: param.payload}, param.type);
}

export async function updateMyPwd(param) {
  return request(baseUrl + 'user/updateMyPwd',{ method:'post', data: param.payload}, param.type);
}